package com.qf.quduba.service.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.qf.quduba.dao.RechargeDAO;
import com.qf.quduba.dao.UserDAO;
import com.qf.quduba.entity.Recharge;
import com.qf.quduba.entity.User;
import com.qf.quduba.service.UserService;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
 * @author 17312
 * @time2020/10/1020:50
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserDAO userDAO;
    @Resource
    private RechargeDAO rechargeDAO;


    @Override
    public User loginByUsernameAndPassword(String username, String password) {

        return userDAO.loginByUsernameAndPassword(username, password);
    }

    @Override
    public int registerUser(User user) {
        return userDAO.registerUser(user);
    }

    @Override
    public User selectUser(Integer userId) {
        return rechargeDAO.selectUser(userId);
    }

    @Override
    public int updateByPrimaryKeySelective(User user) {
        return userDAO.updateByPrimaryKeySelective(user);
    }

    @Override
    public int addAuthor(User user) {
        return userDAO.addAuthor(user);
    }

    @Override
    public int updateUserMoney(Integer userId, Double newMoney) {
        return userDAO.updateUserMoney(userId,newMoney);
    }
}
